<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue html5 editor demo</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <script src="../dist/vue-html5-editor.js"></script>
    <script src="https://cdn.bootcss.com/vue/2.1.10/vue.js"></script>
    <link href="https://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <style>
        #app {
            margin: 50px auto;
            width: 800px;
            max-width: 100%;
        }
    </style>
</head>
<body>
<div id="app">
    <p>
        <button type="button" @click="focus">focus</button>
        <button type="button" @click="fullScreen">full screen</button>
        <button type="button" @click="showModuleName=!showModuleName">toggle module name</button>
        <span style="white-space: nowrap">content length : {{content.length}}</span>
    </p>

    <vue-html5-editor :content="content" :height="300" :show-module-name="showModuleName"
                      @change="updateData" ref="editor"></vue-html5-editor>
</div>

<script>
    Vue.use(VueHtml5Editor, {
        showModuleName: true,
        image: {
            sizeLimit: 512 * 1024,
            compress: true,
            width: 500,
            height: 500,
            quality: 80
        }
    })

    new Vue({
        el: "#app",
        data: {
            content: "<h3>vue html5 editor</h3>",
            showModuleName: false,
        },
        methods: {
            updateData: function (data) {
                // sync content to component
                this.content = data
            },
            fullScreen: function () {
                this.$refs.editor.enableFullScreen()
            },
            focus: function () {
                this.$refs.editor.focus()
            }
        }
    })
</script>
</body>
</html>